<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
<%@page import="com.util.PublicToolCheckParam" %>
<%@page import="com.entity.OrderInfo" %>
<%@page import="com.entity.CustomerDetailInfo" %>
<%@page import="com.dao.CustomerDetailInfoDAO" %>
<%@page import="com.dao.CustomerInfoDAO" %>
<%@page import="com.entity.CustomerInfo" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
    <title>门诊就诊管理</title>
    <link type="text/css" rel="stylesheet" href="../css/style.css"/>
    <script type="text/javascript" src="../js/admin/manageOrder.js" charset="utf-8"></script>
</head>

<body>
<form action="../servlet/ManageOrder?method=deleteMore" method="post">
    <table width="100%" border="0" cellpadding="0" cellspacing="0" style="font-size:13px;">
        <tr>
            <td width="100%" height="36">
                <strong><font color="#666666" size="3">门诊就诊管理</font></strong>
            </td>

        </tr>
        <tr>
            <td height="40" colspan="4">
                <hr width="100%"/>
            </td>
        </tr>
        <tr>
            <td height="147" colspan="4">


                统计信息 就诊总数：<%=request.getAttribute("sumCount")%>

                <table width="100%" border="1" cellpadding="0" cellspacing="0" style="font-size:13px" bordercolor="#cccccc">
                    <tr height="30">

                        <td>
                            <div align="center"><font color="#666666">就诊编号</font></div>
                        </td>
                        <td>
                            <div align="center"><font color="#666666">就诊状态</font></div>
                        </td>
                        <td>
                            <div align="center"><font color="#666666">就诊时间</font></div>
                        </td>
                        <td>
                            <div align="center"><font color="#666666">患者账户/邮箱</font></div>
                        </td>
                        <td>
                            <div align="center"><font color="#666666">患者</font></div>
                        </td>
                        <td>
                            <div align="center"><font color="#666666">移动电话</font></div>
                        </td>
                        <td>
                            <div align="center"><font color="#666666">操作</font></div>
                        </td>
                    </tr>
                    <%
                         ArrayList<OrderInfo> orderInfoList = (ArrayList<OrderInfo>) request.getAttribute("orderInfoList");
                        CustomerDetailInfoDAO cddao = new CustomerDetailInfoDAO();
                        CustomerInfoDAO cdao = new CustomerInfoDAO();
                        if (orderInfoList == null || orderInfoList.toString().equals("[]")) {
                            out.println("<td colspan='10' height='30'><div align='center'>当前无任何就诊信息!</div></td>");
                        } else {
                            for (int i = 0; i < orderInfoList.size(); i++) {
                                OrderInfo od = orderInfoList.get(i);
                                CustomerDetailInfo customerDetailInfo = cddao.getCustomerDetailInfo(od.getCustomerId());
                                CustomerInfo customerInfo = cdao.getCustomerInfo(customerDetailInfo.getCustomerId());
                                out.println("<tr height='30'>");
                                out.println("<td><div align='center'>" + od.getOrderId() + "</div></td>");

                                if (od.getStatus() == 0) {
                                    out.println("<td><div align='center'><font color='#FF0000'>已挂号排队中</font></div></td>");
                                } else if (od.getStatus() == 1) {
                                    out.println("<td><div align='center'>检查缴费</div></td>");
                                } else if (od.getStatus() == 100) {
                                    out.println("<td><div align='center'>治疗完毕</div></td>");
                                } else if (od.getStatus() == 101) {
                                    out.println("<td><div align='center'>已复诊</div></td>");
                                }else if (od.getStatus() == 99) {
                                	out.println("<td><div align='center'>已取消排队</div></td>");
                                }


                                out.println("<td><div align='center'>" + od.getOrderTime() + "</div></td>");
                                out.println("<td><div align='center'>" + customerInfo.getEmail() + "</div></td>");
                                out.println("<td><div align='center'>" + customerDetailInfo.getName() + "</div></td>");
                                out.println("<td><div align='center'>" + customerDetailInfo.getMovePhone() + "</div></td>");


                                out.println("<td><div align='center'> <a href='../servlet/ManageOrder?method=showDetail&orderId=" + od.getOrderId() + "'>详情</a>&nbsp;&nbsp;&nbsp;&nbsp;<a href='#' onclick=deleteOrder(" + od.getOrderId() + ")>删除</a></div></td>");


                                out.println("</tr>");
                            }
                        }
                    %>
                    <tr>
                        <td colspan="10" height="50">
                            <div align="center">共找到<%=request.getAttribute("sumCount")%>条记录&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;第<%=request.getAttribute("currentPage")%>/<%=request.getAttribute("sumPageCount")%>页&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="../servlet/ManageOrder?method=<%out.println("showManageOrderPage");%>&cp=<%=request.getAttribute("indexPage")%>">首页</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="../servlet/ManageOrder?method=<%out.println("showManageOrderPage");%>&cp=<%=request.getAttribute("upPage")%>">上一页</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="../servlet/ManageOrder?method=<%out.println("showManageOrderPage");%>&cp=<%=request.getAttribute("nextPage")%>">下一页</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="../servlet/ManageOrder?method=<%out.println("showManageOrderPage");%>&cp=<%=request.getAttribute("lastPage")%>">尾页</a>
                            </div>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</form>
</body>
</html>
